Add environment variables support with tests #121
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add support for passing environment variables via command line arguments with both long form (--envVars) and short form (-e) options.
Motivation and Context
When running MCP servers, users often need to pass environment variables for configuration (API keys, debug flags, etc.). Currently, this requires setting environment variables before running the inspector or modifying the system environment. This change allows for more flexible and explicit environment variable configuration directly through command line arguments.
How Has This Been Tested?
Added comprehensive test suite in
server/src/__tests__/env-vars.test.tscovering:All tests pass locally. Example usage tested: